import QtQuick 2.0
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.2
import "matrix_js.js" as MAT

Rectangle {
    id:mainForm
    width: 800
    height: 800

    Rectangle{
        id:matrixShow
        anchors.top: parent.top
        anchors.left: parent.left
        width: 200
        height: 400
        border.width: 1
        border.color: "black"
        RowLayout{
            anchors.bottom: matrix_txt.top
            Text{
                text:"以";
            }
            TextField{
                id:node_txt
                text:"1";
            }
            Text{
                text:"开始"
            }
        }

        Text{
            id:matrix_txt
            anchors.left: parent.left
            anchors.verticalCenter: parent.verticalCenter
            font.pixelSize: 20
            text: MAT.getMatrix();
        }
        RowLayout{
            anchors.bottom: parent.bottom
            Button{
                text:"刷新"
                onClicked: {
                    matrix_txt.text = MAT.getMatrix();
                }
            }
            Button{
                text:"生成"
                onClicked: {
                    MAT.build();
                }
            }
        }
    }

    Rectangle{
        anchors.bottom: parent.bottom
        anchors.left: parent.left
        id: adj
        width: 800
        height: 400
        border.width: 1
        border.color: "black"

        Flickable
        {
            id:flickadj
            anchors.fill:parent
            anchors.centerIn: parent.Center
            contentWidth: 3000
            contentHeight: adj_txt.height
            flickableDirection: Flickable.HorizontalFlick
            Text{
                id: adj_txt
                anchors.left: parent.left
                anchors.verticalCenter: parent.verticalCenter;
                font.pixelSize: 20
                text: ""
            }
        }
    }

    Rectangle{
        anchors.top: parent.top
        anchors.left: matrixShow.right;
        anchors.right: dfs.left
        id: bfs
        width: 300
        height: 400
        border.width: 1
        border.color: "black"
        Flickable
        {
            id:flickbfs
            anchors.fill: parent
            width:parent.width
            height:parent.height
            contentWidth: bfs_txt.width
            contentHeight: 1000
            flickableDirection: Flickable.VerticalFlick
            Text{
                id:bfs_txt
                anchors.fill: parent
                wrapMode: Text.WordWrap
                font.pixelSize: 18
            }
        }
    }

    Rectangle{
        anchors.top: parent.top
        anchors.right:mainForm.right
        id:dfs
        width: 300
        height: 400
        border.width: 1
        border.color: "black"
        Flickable
        {
            id:flickArea
            anchors.fill:parent
            anchors.centerIn: parent.Center
            contentWidth: dfs_txt.width
            contentHeight: 1000
            flickableDirection: Flickable.VerticalFlick
            Text{
                anchors.fill:parent
                id:dfs_txt
                font.pixelSize: 18
                wrapMode: Text.WordWrap
            }
        }
    }
}
